package com.ruoyi.consumables.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.consumables.mapper.ConsumablesMapper;
import com.ruoyi.consumables.domain.Consumables;
import com.ruoyi.consumables.service.IConsumablesService;
import com.ruoyi.common.core.text.Convert;

/**
 * 耗材记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-04-22
 */
@Service
public class ConsumablesServiceImpl implements IConsumablesService 
{
    @Autowired
    private ConsumablesMapper consumablesMapper;

    /**
     * 查询耗材记录
     * 
     * @param consumablesId 耗材记录主键
     * @return 耗材记录
     */
    @Override
    public Consumables selectConsumablesByConsumablesId(Long consumablesId)
    {
        return consumablesMapper.selectConsumablesByConsumablesId(consumablesId);
    }

    /**
     * 查询耗材记录列表
     * 
     * @param consumables 耗材记录
     * @return 耗材记录
     */
    @Override
    public List<Consumables> selectConsumablesList(Consumables consumables)
    {
        return consumablesMapper.selectConsumablesList(consumables);
    }

    /**
     * 新增耗材记录
     * 
     * @param consumables 耗材记录
     * @return 结果
     */
    @Override
    public int insertConsumables(Consumables consumables)
    {
        consumables.setCreateTime(DateUtils.getNowDate());
        return consumablesMapper.insertConsumables(consumables);
    }

    /**
     * 修改耗材记录
     * 
     * @param consumables 耗材记录
     * @return 结果
     */
    @Override
    public int updateConsumables(Consumables consumables)
    {
        consumables.setUpdateTime(DateUtils.getNowDate());
        return consumablesMapper.updateConsumables(consumables);
    }

    /**
     * 批量删除耗材记录
     * 
     * @param consumablesIds 需要删除的耗材记录主键
     * @return 结果
     */
    @Override
    public int deleteConsumablesByConsumablesIds(String consumablesIds)
    {
        return consumablesMapper.deleteConsumablesByConsumablesIds(Convert.toStrArray(consumablesIds));
    }

    /**
     * 删除耗材记录信息
     * 
     * @param consumablesId 耗材记录主键
     * @return 结果
     */
    @Override
    public int deleteConsumablesByConsumablesId(Long consumablesId)
    {
        return consumablesMapper.deleteConsumablesByConsumablesId(consumablesId);
    }
}
